package com.cdtu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdtu.entity.Task;
import com.cdtu.service.TaskService;
import com.cdtu.mapper.TaskMapper;
import com.cdtu.vo.SpecialityVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
* @author Sakura
* @description 针对表【task】的数据库操作Service实现
* @createDate 2023-01-14 11:22:38
*/
@Service
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>
    implements TaskService{

    @Autowired
    private TaskMapper taskMapper;

    @Override
    public List<String> findByIds(List<Long> ids) {

        //如果ids为0，则返回空的集合
        if (ids.size()==0){
            List<String> result=new ArrayList<>();
            return result;
        }

        List<Task> tasks = taskMapper.selectBatchIds(ids);
        List<String> taskName=new ArrayList<>();

        for (Task task : tasks) {
            taskName.add(task.getDetail());
        }

        return taskName;
    }
}




